import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
import Header from '../views/Header.vue'
import Footer from '../views/Footer.vue'
import Home from '../views/Home.vue'
import Menu from '../views/menu/Menu.vue'
import Community from '../views/Community.vue'
import Health from '../views/Health.vue'
import Piao from '../views/Piao.vue'
import Exchange from '../views/Exchange.vue'
import Person from '../views/Person.vue'


import PubMenu from '../views/PubMenu.vue'
import PubNote from '../views/PubNote.vue'

import Register from '../views/menu/Register.vue'
import Login from '../views/menu/Login.vue'

import ActiveList from '../views/ActiveList.vue'
import Activity from '../views/Activity.vue'
import NoteList from '../views/NoteList.vue'
import Note from '../views/Note.vue'
import HealthList from '../views/HealthList.vue'
import ExchangeList from '../views/ExchangeList.vue'
// import ActivityAgo from '@/components/ActivityAgo.vue'
// import ActivityNote from '@/components/ActivityNote.vue'

import Change from '../views/Change.vue'

import HealthChild from '../views/HealthChild.vue'
import MenuChild from '../views/menu/MenuChild.vue'
import Menulist from '../views/menu/Menulist.vue'
// import Food from '../views/menu/Food.vue'


// 个人中心
import PersonCenter from '../views/personCenter/layout/index.vue'



const routes = [
  {
    path: '/',
    name: 'Home',
    components: {
      default: Home,
      'header': Header,
      'footer': Footer,
    }
  },
  //=======菜单menu========
  {
    path: '/menuchild/:id',
    name: 'menuchild',
    components: {
      default: MenuChild,
      'header': Header,
      'footer': Footer,
    },
  },
  {
    path: '/menu',
    components: {
      default: Menu,
      'header': Header,
      'footer': Footer,
    },
    children: [
      {
        path: '',
        component: Menulist
      },

      {
        path: 'menulist',
        component: Menulist,

      },
    
      {
        name: 'menusearch',
        path: 'menulist/:id',
        component: Menulist
      },

    ]
  },
  {
    path: '/menu/:id',
    name: 'Menu',
    components: {
      default: Menu,
      'header': Header,
      'footer': Footer,
    },

  },
  {
    path: '/menu/:id/menuChild',
    name: 'MenuChild',
    components: {
      default: MenuChild,
      'header': Header,
      'footer': Footer,
    },
  },

  {
    path: '/community',
    components: {
      default: Community,
      'header': Header,
      'footer': Footer,
    },
    children: [
      {
        path: 'notelist',
        components: {
          default: NoteList,
          'header': Header,
          'footer': Footer,
        }
      },
      {
        path: 'activelist',
        component: ActiveList

      },
      {
        path: '/community',
        component: NoteList

      },
    ]
  },
  {
    path: '/community/notelist/note/:id',
    name: 'Note',
    components: {
      default: Note,
      'header': Header,
      'footer': Footer,
    }
  },
  {
    path: '/activity/:id',
    name: 'activity',
    components: {
      default: Activity,
      'header': Header,
      'footer': Footer,
    }
  },
  {
    path: '/health',
    name: 'Health',
    components: {
      default: Health,
      'header': Header,
      'footer': Footer,
    },
    children: [
      {
        path: '',
        component: HealthList
      },
      {
        path: 'healthList/:id',
        component: HealthList,
        name: 'healthList'
      }
    ]
  },
  {
    path: '/healthChild/:id',
    name: 'healthChild',
    components: {
      default: HealthChild,
      'header': Header,
      'footer': Footer,
    }
  },
  {
    path: '/pubMenu',
    components: {
      default: PubMenu,
      'header': Header,
      'footer': Footer,
    }
  },
  {
    path: '/pubNote',
    components: {
      default: PubNote,
      'header': Header,
      'footer': Footer,
    }
  },
  {
    path: '/piao',
    components: {
      default: Piao
    }
  },
  {
    path: '/login',
    components: {
      default: Login,
      'header': null,
      'footer': null,
    }
  },
  {
    path: '/register',
    components: {
      default: Register,
      'header': null,
      'footer': null,
    }
  },
  {
    path: '/person',
    components: {
      default: Person,
      'header': Header,
      'footer': Footer,
    }
  },
  {
    path: '/exchange',
    components: {
      default: Exchange,
      'header': Header,
      'footer': Footer,
    },
    children: [
      {
        path: '',
        component: ExchangeList,
        name: 'exchangeList'
      }
    ]
  },



  //==个人中心==
  {
    path: '/personcenter',
    meta: {
      requireAuth: true
    },
    component: PersonCenter,
  },
  {
    path: '/othercenter',
    name:"othercenter",
    meta: {
      requireAuth: true
    },
    component: () => import('@/views/personCenter/other/index.vue')
  }
  //==个人中心==


]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})


export default router
